Skip to content

[AUTOMATIONS-CONTRACT] Vesting Scheduler V3#2054

Merged
kasparkallas merged 64 commits intosuperfluid-org:devfrom
0xPilou:vesting-scheduler-v3
May 8, 2025
Merged

[AUTOMATIONS-CONTRACT] Vesting Scheduler V3#2054
kasparkallas merged 64 commits intosuperfluid-org:devfrom
0xPilou:vesting-scheduler-v3

Conversation

@0xPilou
Copy link
Contributor

@0xPilou 0xPilou commented Feb 24, 2025

Vesting Scheduler V3 offers the possibility for vesting sender to update their vesting schedule amounts and/or durations.

Modifications includes :

  • Add total amount and already vested amount tracking to VestingSchedule
  • Add overloaded updateVestingSchedule method with dynamic flow rate calculation
  • Update interface to include new vesting schedule tracking fields
  • Review early termination and compensation logic

Optimism Sepolia Deployment :
Contract is deployed at 0x2dCFbF5BcE0522257E78bF164871770D30634A96

0xPilou and others added 28 commits February 20, 2025 10:32
- Rename `updateVestingSchedule` to `updateVestingScheduleEndDate`
- Optimize schedule update mechanism with more precise vesting calculations
- Simplify flow rate and remainder amount handling
- Update error handling and edge case management
- Add comprehensive test cases for `updateVestingScheduleEndDate` and `updateVestingScheduleAmount`
- Improve error handling tests for non-existent vesting schedules
- Refactor existing tests to use new method signatures
- Optimize test scenarios for end date and amount updates
- Introduce `_settle` method to handle vesting schedule updates and tracking
- Remove `totalAmount` from storage and improve vesting calculation logic
- Add `lastUpdated` timestamp to track precise vesting progress
- Enhance early termination and compensation handling
- Commented out unused update methods with TODOs for future implementation
- Update test cases to reflect recent refactoring of vesting schedule mechanisms
- Remove commented-out test methods for non-existent schedule updates
- Improve settlement calculation by using total amount to vest
- Simplify vesting schedule verification in test scenarios
- Adjust settlement calculation to subtract cliff amount from already vested amount
- Optimize total vested amount calculation by improving parentheses placement
- Refactor `_executeCliffAndFlow` and `executeEndVesting` to handle vesting amounts more precisely
- Update test cases to improve vesting amount and timing calculations
- Simplify test setup and execution flow
- Enhance precision in settlement and balance verification
- Optimize time warping and event expectation in test methods
- Refactor `_getTotalVestedAmount` to enhance clarity and precision of vesting calculations
- Correct remainder amount calculation by subtracting flow rate duration from total vested amount
- Add comments to clarify vesting logic for different schedule stages
- Optimize flow amount calculation with improved variable naming
- Replace hardcoded early end time calculation with bounded randomization
- Remove unused total amount to vest calculation
- Comment out previous early end time calculation method
- Improve test scenario randomness and flexibility
- Restore original early end time calculation using division
- Remove bounded randomization approach
- Simplify early vesting end time selection logic
…hedule update logic

- Add implementation for `updateVestingScheduleFlowRateFromAmount` method
- Enhance schedule update validation with comprehensive time window checks
- Improve settlement logic in `_settle` method
- Optimize flow rate and remainder amount calculations during schedule updates
- Add comments to clarify update conditions and vesting logic
…dulerV3

- Implement new events `VestingScheduleTotalAmountUpdated` and `VestingScheduleEndDateUpdated`
- Update event emissions to include remainder amount and flow rate details
- Rename `updateVestingScheduleEndDate` to `updateVestingScheduleFlowRateFromEndDate`
- Enhance event logging with comprehensive schedule update information
… updates

- Modify test methods to use `updateVestingScheduleFlowRateFromEndDate`
- Enhance calculation of expected remainder and new flow rate
- Update test assertions to verify total vested amount and balance transfers
- Refactor batch operation encoding to match new method signature
…method

- Delete unused and commented-out method from VestingSchedulerV3
- Clean up code by removing deprecated implementation with TODO comments
- Simplify contract by eliminating unimplemented method
…dates

- Implement test scenarios for updating vesting schedules with longer and shorter durations
- Add test cases for updating vesting schedule amounts (both larger and smaller)
- Uncomment and update previously commented-out test method for non-existent schedule updates
- Enhance test coverage for flow rate and remainder calculations during schedule modifications
added support for batch calls using OPERATION_TYPE_ERC2771_FORWARD_CALL
@0xPilou 0xPilou marked this pull request as ready for review February 28, 2025 13:22
@0xPilou 0xPilou requested a review from hellwolf as a code owner February 28, 2025 13:22
@codecov
Copy link

codecov bot commented May 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@kasparkallas kasparkallas merged commit dc3bc63 into superfluid-org:dev May 8, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants